Skip to content

Use PolarisImmutable for StorageCredentialCacheKey #2029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 15, 2025

Conversation

XN137
Copy link
Contributor

@XN137 XN137 commented Jul 11, 2025

note that entityId was not part of the equals/hashCode and thus did not need to be a field

@github-project-automation github-project-automation bot moved this to PRs In Progress in Basic Kanban Board Jul 11, 2025
@XN137 XN137 force-pushed the immutable-StorageCredentialCacheKey branch 2 times, most recently from 39eac51 to a23c4a0 Compare July 14, 2025 06:14
@XN137 XN137 marked this pull request as ready for review July 14, 2025 06:14
+ ", allowedWriteLocations="
+ allowedWriteLocations
+ '}';
return ImmutableStorageCredentialCacheKey.builder()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not delegate to the existing ImmutableStorageCredentialCacheKey.of(...) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it didnt exist until i added @Value.Parameter, but done now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea - this, rather the whole change, is overall be a good improvement not just for the code, but also the "free" improvements like lazy/memoized hash values.

@XN137 XN137 force-pushed the immutable-StorageCredentialCacheKey branch from a23c4a0 to b97764f Compare July 14, 2025 11:34
@github-project-automation github-project-automation bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Jul 14, 2025
Copy link
Contributor

@dimas-b dimas-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR LGTM "as is" (pure refactoring), but I think we need to follow up on including the the entity ID into the cache key.

Comment on lines -34 to -37
/**
* The entity id is passed to be used to fetch subscoped creds, but is not used to do hash/equals
* as part of the cache key.
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that this PR does not change this behaviour, but conceptually if the entity ID is a substantial parameter to computing the cached value, I believe it should be included in the key.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure whether I already mentioned it, but I'm not sure the StorageCredentialCache works as expected, because when credentials are retrieved from the cache, we only know that those are valid at the time of retrieval, but not how long those will be valid (for a client), it could be 0.1ms or 30days.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(But that's not a problem of this PR)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Created #2046)

@dimas-b dimas-b merged commit 9ecf29b into apache:main Jul 15, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from Ready to merge to Done in Basic Kanban Board Jul 15, 2025
@XN137 XN137 deleted the immutable-StorageCredentialCacheKey branch July 16, 2025 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants